﻿/********************************************************************************************************************
* Author:	Christos Polydorou																						*
* Email:	std04237@di.uoa.gr																						*
* Purpose:	This script is used in order to create the stored procedure "usp_usernameexists" that returns 1 if a 	*
*			givven username already exists in the database.															*
********************************************************************************************************************/

CREATE PROCEDURE [dbo].[usp_usernameExists]
	@username nvarchar(50)
AS
	IF EXISTS (SELECT * FROM Users WHERE users.Username = @username)
		RETURN 1
	ELSE
		RETURN 0